package com.atom.process.cnmuseum.cj.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;

import com.atom.common.activiti.HistoricTaskHandler;
import com.atom.common.activiti.RunningTaskHandler;
import com.atom.common.mb.dao.dj.DjDbrwDao;
import com.atom.common.mb.dao.dj.DjGcxxDao;
import com.atom.common.mb.dao.dj.DjMultimediaDao;
import com.atom.common.mb.dao.dj.DjTrackmessageDao;
import com.atom.common.mb.dao.dj.DjWhrlxxxDao;
import com.atom.common.mb.dao.dj.DjWhsxDao;
import com.atom.common.mb.dao.dj.DjXzxxDao;
import com.atom.common.mb.dao.dj.DjXzyxDao;
import com.atom.common.mb.dao.dj.DjYxxxDao;
import com.atom.common.mb.dao.gl.DbrwDao;
import com.atom.common.mb.dao.gl.GcxxDao;
import com.atom.common.mb.dao.gl.MultimediaDao;
import com.atom.common.mb.dao.gl.TrackmessageDao;
import com.atom.common.mb.dao.gl.WhrlxxxDao;
import com.atom.common.mb.dao.gl.WhsxDao;
import com.atom.common.mb.dao.gl.XzxxDao;
import com.atom.common.mb.dao.gl.XzyxDao;
import com.atom.common.mb.dao.gl.YxxxDao;
import com.atom.common.mb.entity.dj.DjDbrwDO;
import com.atom.common.mb.entity.dj.DjGcxxDO;
import com.atom.common.mb.entity.dj.DjMultimediaDO;
import com.atom.common.mb.entity.dj.DjTrackmessageDO;
import com.atom.common.mb.entity.dj.DjWhrlxxxDO;
import com.atom.common.mb.entity.dj.DjWhsxDO;
import com.atom.common.mb.entity.dj.DjXzxxDO;
import com.atom.common.mb.entity.dj.DjXzyxDO;
import com.atom.common.mb.entity.dj.DjYxxxDO;
import com.atom.common.mb.entity.gl.DbrwDO;
import com.atom.common.mb.entity.gl.GcxxDO;
import com.atom.common.mb.entity.gl.MultimediaDO;
import com.atom.common.mb.entity.gl.TrackmessageDO;
import com.atom.common.mb.entity.gl.WhrlxxxDO;
import com.atom.common.mb.entity.gl.WhsxDO;
import com.atom.common.mb.entity.gl.XzxxDO;
import com.atom.common.mb.entity.gl.XzyxDO;
import com.atom.common.mb.entity.gl.YxxxDO;
import com.atom.common.remote.user.UserUtil;
import com.atom.common.service.AbstractAvensCommonService;
import com.atom.process.cnmuseum.cj.dao.dj.DjCjDao;
import com.atom.process.cnmuseum.cj.dao.process.CjDbrwProcessDao;
import com.atom.process.cnmuseum.cj.dao.process.CjGcxxProcessDao;
import com.atom.process.cnmuseum.cj.dao.process.CjMultimediaProcessDao;
import com.atom.process.cnmuseum.cj.dao.process.CjProcessDao;
import com.atom.process.cnmuseum.cj.dao.process.CjTrackmessageProcessDao;
import com.atom.process.cnmuseum.cj.dao.process.CjWhrlxxxProcessDao;
import com.atom.process.cnmuseum.cj.dao.process.CjWhsxProcessDao;
import com.atom.process.cnmuseum.cj.dao.process.CjXzxxProcessDao;
import com.atom.process.cnmuseum.cj.dao.process.CjXzyxProcessDao;
import com.atom.process.cnmuseum.cj.dao.process.CjYxxxProcessDao;
import com.atom.process.cnmuseum.cj.dao.task.CjDbrwTaskDao;
import com.atom.process.cnmuseum.cj.dao.task.CjGcxxTaskDao;
import com.atom.process.cnmuseum.cj.dao.task.CjMultimediaTaskDao;
import com.atom.process.cnmuseum.cj.dao.task.CjTaskDao;
import com.atom.process.cnmuseum.cj.dao.task.CjTrackmessageTaskDao;
import com.atom.process.cnmuseum.cj.dao.task.CjWhrlxxxTaskDao;
import com.atom.process.cnmuseum.cj.dao.task.CjWhsxTaskDao;
import com.atom.process.cnmuseum.cj.dao.task.CjXzxxTaskDao;
import com.atom.process.cnmuseum.cj.dao.task.CjXzyxTaskDao;
import com.atom.process.cnmuseum.cj.dao.task.CjYxxxTaskDao;
import com.atom.process.cnmuseum.cj.entity.process.CjDbrwProcessDO;
import com.atom.process.cnmuseum.cj.entity.process.CjGcxxProcessDO;
import com.atom.process.cnmuseum.cj.entity.process.CjMultimediaProcessDO;
import com.atom.process.cnmuseum.cj.entity.process.CjProcessDO;
import com.atom.process.cnmuseum.cj.entity.process.CjTrackmessageProcessDO;
import com.atom.process.cnmuseum.cj.entity.process.CjWhrlxxxProcessDO;
import com.atom.process.cnmuseum.cj.entity.process.CjWhsxProcessDO;
import com.atom.process.cnmuseum.cj.entity.process.CjXzxxProcessDO;
import com.atom.process.cnmuseum.cj.entity.process.CjXzyxProcessDO;
import com.atom.process.cnmuseum.cj.entity.process.CjYxxxProcessDO;
import com.atom.process.cnmuseum.cj.entity.task.CjDbrwTaskDO;
import com.atom.process.cnmuseum.cj.entity.task.CjGcxxTaskDO;
import com.atom.process.cnmuseum.cj.entity.task.CjMultimediaTaskDO;
import com.atom.process.cnmuseum.cj.entity.task.CjTaskDO;
import com.atom.process.cnmuseum.cj.entity.task.CjTrackmessageTaskDO;
import com.atom.process.cnmuseum.cj.entity.task.CjWhrlxxxTaskDO;
import com.atom.process.cnmuseum.cj.entity.task.CjWhsxTaskDO;
import com.atom.process.cnmuseum.cj.entity.task.CjXzxxTaskDO;
import com.atom.process.cnmuseum.cj.entity.task.CjXzyxTaskDO;
import com.atom.process.cnmuseum.cj.entity.task.CjYxxxTaskDO;
import com.atom.process.cnmuseum.cj.render.CJRender;
import com.atom.process.cnmuseum.cj.tool.UserResolver;
import com.atom.process.cnmuseum.cj.vo.request.GcxxRequestVO;
import com.atom.process.cnmuseum.cj.vo.request.RequestVO;
import com.atom.process.cnmuseum.cj.vo.request.WhrlxxxRequestVO;
import com.atom.process.cnmuseum.cj.vo.request.XzxxRequestVO;
import com.atom.process.cnmuseum.cj.vo.request.YxxxRequestVO;
import com.sinosoft.cnmuseum.servlets.MbXtglBaseTableServlet;
import com.sinosoft.cnmuseum.utils.LogUtils;

public abstract class AbstractService extends AbstractAvensCommonService {
    @Resource
    CjProcessDao cjProcessDao;
    @Resource
    CjTaskDao cjTaskDao;
    @Resource
    DjCjDao djCjDao;


    @Resource
    CjGcxxProcessDao cjGcxxProcessDao;
    @Resource
    CjGcxxTaskDao cjGcxxTaskDao;
    @Resource
    DjGcxxDao djGcxxDao;
    @Resource
    GcxxDao gcxxDao;


    @Resource
    CjXzxxProcessDao cjXzxxProcessDao;
    @Resource
    CjXzxxTaskDao cjXzxxTaskDao;
    @Resource
    DjXzxxDao djXzxxDao;
    @Resource
    XzxxDao xzxxDao;

    @Resource
    CjYxxxProcessDao cjYxxxProcessDao;
    @Resource
    CjYxxxTaskDao cjYxxxTaskDao;
    @Resource
    DjYxxxDao djYxxxDao;
    @Resource
    YxxxDao yxxxDao;


    @Resource
    CjWhrlxxxProcessDao cjWhrlxxxProcessDao;
    @Resource
    CjWhrlxxxTaskDao cjWhrlxxxTaskDao;
    @Resource
    DjWhrlxxxDao djWhrlxxxDao;
    @Resource
    WhrlxxxDao whrlxxxDao;
    
       
    @Resource
    CjDbrwProcessDao cjDbrwProcessDao;
    @Resource
    CjDbrwTaskDao cjDbrwTaskDao;
    @Resource
    DjDbrwDao djDbrwDao;
    @Resource
    DbrwDao dbrwDao;
    
    @Resource
    CjMultimediaProcessDao cjMultimediaProcessDao;
    @Resource
    CjMultimediaTaskDao cjMultimediaTaskDao;
    @Resource
    DjMultimediaDao djMultimediaDao;
    @Resource
    MultimediaDao multimediaDao;
    
    
    @Resource
    CjTrackmessageProcessDao cjTrackmessageProcessDao;
    @Resource
    CjTrackmessageTaskDao cjTrackmessageTaskDao;
    @Resource
    DjTrackmessageDao djTrackmessageDao;
    @Resource
    TrackmessageDao trackmessageDao;
    
    
    @Resource
    CjXzyxProcessDao cjXzyxProcessDao;
    @Resource
    CjXzyxTaskDao cjXzyxTaskDao;
    @Resource
    DjXzyxDao djXzyxDao;
    @Resource
    XzyxDao xzyxDao;
    
    

    

    @Resource
    CjWhsxProcessDao cjWhsxProcessDao;
    @Resource
    CjWhsxTaskDao cjWhsxTaskDao;
    @Resource
    DjWhsxDao djWhsxDao;
    @Resource
    WhsxDao whsxDao;
    
    
    @Resource
    UserResolver userResolver;
    @Resource
    CJRender render;
    @Resource
    protected RunningTaskHandler runningTaskHandler;
    @Resource
    protected HistoricTaskHandler historicTaskHandler;


    protected void createPdo(UserUtil user, String processInstanceId, String biaoTi) {
        cjProcessDao.createPDO(user, processInstanceId, biaoTi);
        //采集日志
        LogUtils logUtils = new LogUtils();
        String desc = biaoTi+LogUtils.MbXtglSJCJ_INSERT_DESC;
        logUtils.addLog(String.valueOf(LogUtils.type_insert), LogUtils.model_sjcj, user.getUserid(), desc);
        cjGcxxProcessDao.createPDO(user, processInstanceId);
        //馆藏基本信息日志
        String descGcxx = biaoTi+"馆藏基本信息"+LogUtils.MbXtglSJCJ_INSERT_DESC;
        logUtils.addLog(String.valueOf(LogUtils.type_insert), LogUtils.model_sjcj, user.getUserid(), descGcxx);
        cjXzxxProcessDao.createPDO(user, processInstanceId);
        //形制信息日志
        String descXzxx = biaoTi+"形制信息"+LogUtils.MbXtglSJCJ_INSERT_DESC;
        logUtils.addLog(String.valueOf(LogUtils.type_insert), LogUtils.model_sjcj, user.getUserid(), descXzxx);
        cjYxxxProcessDao.createPDO(user, processInstanceId);
        //音响信息日志
        String descYxxx = biaoTi+"音响信息"+LogUtils.MbXtglSJCJ_INSERT_DESC;
        logUtils.addLog(String.valueOf(LogUtils.type_insert), LogUtils.model_sjcj, user.getUserid(), descYxxx);
        cjWhrlxxxProcessDao.createPDO(user, processInstanceId);
        //人文信息日志
        String descWhrlxxx = biaoTi+"人文信息"+LogUtils.MbXtglSJCJ_INSERT_DESC;
        logUtils.addLog(String.valueOf(LogUtils.type_insert), LogUtils.model_sjcj, user.getUserid(), descWhrlxxx);
    }

    protected void createAdo(UserUtil user, String processInstanceId, String taskId, String biaoTi) {
        cjTaskDao.createADO(user, processInstanceId, taskId, biaoTi);
        String gcxxid = cjGcxxTaskDao.createADO(user, processInstanceId, taskId).toString();
        cjXzxxTaskDao.createADO(user, processInstanceId, taskId, gcxxid);
        cjYxxxTaskDao.createADO(user, processInstanceId, taskId, gcxxid);
        cjWhrlxxxTaskDao.createADO(user, processInstanceId, taskId, gcxxid);
    }

    protected void saveAdo(String taskId, RequestVO vo, GcxxRequestVO gcxxvo, XzxxRequestVO xzxxvo, YxxxRequestVO yxxxvo, WhrlxxxRequestVO whrlxxxvo,  UserUtil user,String title) {
       
    	CjTaskDO cj_ado = cjTaskDao.findByTaskId(taskId);
        BeanUtils.copyProperties(vo, cj_ado, "id", "taskId", "processId");
        cj_ado.setYourAdvice(vo.getYourAdvice());
        cjTaskDao.update(cj_ado);
        //生成日志
        LogUtils logUtils = new LogUtils();
        String desc = title+LogUtils.MbXtglSJCJ_UPDATE_DESC;
        logUtils.addLog(String.valueOf(LogUtils.type_update), LogUtils.model_sjcj, user.getUserid(), desc);
        //馆藏信息
        CjGcxxTaskDO ado = cjGcxxTaskDao.findByTaskId(taskId);
        BeanUtils.copyProperties(gcxxvo, ado, "id", "taskId", "processId");
        String year = gcxxvo.getYear();
        String yearText = new MbXtglBaseTableServlet().getNdTextById(year);
        ado.setYear_text(yearText);
        cjGcxxTaskDao.update(ado);
        //生成日志
        String descGcxx = title+"馆藏基本信息"+LogUtils.MbXtglSJCJ_UPDATE_DESC;
        logUtils.addLog(String.valueOf(LogUtils.type_update), LogUtils.model_sjcj, user.getUserid(), descGcxx);
        //形制信息
        CjXzxxTaskDO xzado = cjXzxxTaskDao.findByTaskId(taskId);
        BeanUtils.copyProperties(xzxxvo, xzado, "id", "taskId", "processId");
        cjXzxxTaskDao.update(xzado);
        //生成日志
        String descjXzxx = title+"形制信息"+LogUtils.MbXtglSJCJ_UPDATE_DESC;
        logUtils.addLog(String.valueOf(LogUtils.type_update), LogUtils.model_sjcj, user.getUserid(), descjXzxx);
        //音响信息
        CjYxxxTaskDO yxado = cjYxxxTaskDao.findByTaskId(taskId);
        BeanUtils.copyProperties(yxxxvo, yxado, "id", "taskId", "processId");
        cjYxxxTaskDao.update(yxado);
        //生成日志
        String descYxxx = title+"音响信息"+LogUtils.MbXtglSJCJ_UPDATE_DESC;
        logUtils.addLog(String.valueOf(LogUtils.type_update), LogUtils.model_sjcj, user.getUserid(), descYxxx);

        //人文信息
        CjWhrlxxxTaskDO whrlxxxado = cjWhrlxxxTaskDao.findByTaskId(taskId);
        BeanUtils.copyProperties(whrlxxxvo, whrlxxxado, "id", "taskId", "processId");
        cjWhrlxxxTaskDao.update(whrlxxxado);
        //生成日志
        String descWhrlxxx = title+"人文信息"+LogUtils.MbXtglSJCJ_UPDATE_DESC;
        logUtils.addLog(String.valueOf(LogUtils.type_update), LogUtils.model_sjcj, user.getUserid(), descWhrlxxx);
    }

    protected void ADO2PDO(String mainProcessInstanceId, String taskId) {
        CjTaskDO cj_ado = cjTaskDao.findByTaskId(taskId);
        CjProcessDO cj_pdo = cjProcessDao.findByProcessInstanceId(mainProcessInstanceId);
        BeanUtils.copyProperties(cj_ado, cj_pdo, "id");
        cjProcessDao.update(cj_pdo);
        //馆藏信息
        CjGcxxTaskDO ado = cjGcxxTaskDao.findByTaskId(taskId);
        CjGcxxProcessDO pdo = cjGcxxProcessDao.findByProcessInstanceId(mainProcessInstanceId);
        BeanUtils.copyProperties(ado, pdo, "id");
        cjGcxxProcessDao.update(pdo);
        //形制信息
        CjXzxxTaskDO xzado = cjXzxxTaskDao.findByTaskId(taskId);
        CjXzxxProcessDO xzpdo = cjXzxxProcessDao.findByProcessInstanceId(mainProcessInstanceId);
        BeanUtils.copyProperties(xzado, xzpdo, "id");
        cjXzxxProcessDao.update(xzpdo);
        //音响信息
        CjYxxxTaskDO yxado = cjYxxxTaskDao.findByTaskId(taskId);
        CjYxxxProcessDO yxpdo = cjYxxxProcessDao.findByProcessInstanceId(mainProcessInstanceId);
        BeanUtils.copyProperties(yxado, yxpdo, "id");
        cjYxxxProcessDao.update(yxpdo);

        //文化人类学信息
        CjWhrlxxxTaskDO whrlxxxado = cjWhrlxxxTaskDao.findByTaskId(taskId);
        CjWhrlxxxProcessDO whrlxxxpdo = cjWhrlxxxProcessDao.findByProcessInstanceId(mainProcessInstanceId);
        BeanUtils.copyProperties(whrlxxxado, whrlxxxpdo, "id");
        cjWhrlxxxProcessDao.update(whrlxxxpdo);
        
        

        List<CjDbrwProcessDO> dbrwpdo_list = cjDbrwProcessDao.findByProcessInstanceId(mainProcessInstanceId);
        for(CjDbrwProcessDO dbrwpdo:dbrwpdo_list){  
        	cjDbrwProcessDao.delete(dbrwpdo);
        }
        List<CjDbrwTaskDO> dbrwado_list = cjDbrwTaskDao.findByTaskId(taskId);
        for(CjDbrwTaskDO dbrwado:dbrwado_list){
        	CjDbrwProcessDO dbrwpdo = new CjDbrwProcessDO();
        	BeanUtils.copyProperties(dbrwado,dbrwpdo, "id");
        	cjDbrwProcessDao.save(dbrwpdo);
        }
        
        //多媒体信息
        List<CjMultimediaProcessDO> multimediapdo_list = cjMultimediaProcessDao.findByProcessInstanceId(mainProcessInstanceId);
        for(CjMultimediaProcessDO multimediapdo:multimediapdo_list){  
        	cjMultimediaProcessDao.delete(multimediapdo);
        }
        List<CjMultimediaTaskDO> multimediaado_list = cjMultimediaTaskDao.findByTaskId(taskId);
        for(CjMultimediaTaskDO multimediaado:multimediaado_list){
        	CjMultimediaProcessDO multimediapdo = new CjMultimediaProcessDO();
        	BeanUtils.copyProperties(multimediaado,multimediapdo, "id");
        	cjMultimediaProcessDao.save(multimediapdo);
        }
        
        //曲目信息
        List<CjTrackmessageProcessDO> trackmessagepdo_list = cjTrackmessageProcessDao.findByProcessInstanceId(mainProcessInstanceId);
        for(CjTrackmessageProcessDO trackmessagepdo:trackmessagepdo_list){  
        	cjTrackmessageProcessDao.delete(trackmessagepdo);
        }
        List<CjTrackmessageTaskDO> trackmessageado_list = cjTrackmessageTaskDao.findByTaskId(taskId);
        for(CjTrackmessageTaskDO trackmessageado:trackmessageado_list){
        	CjTrackmessageProcessDO trackmessagepdo = new CjTrackmessageProcessDO();
        	BeanUtils.copyProperties(trackmessageado,trackmessagepdo, "id");
        	cjTrackmessageProcessDao.save(trackmessagepdo);
        }
        
        //形制文件信息
        List<CjXzyxProcessDO> xzwjxxpdo_list = cjXzyxProcessDao.findByProcessInstanceId(mainProcessInstanceId,"xz");
        for(CjXzyxProcessDO xzwjxxpdo:xzwjxxpdo_list){  
        	cjXzyxProcessDao.delete(xzwjxxpdo);
        }
        List<CjXzyxTaskDO> xzwjxxado_list = cjXzyxTaskDao.findByTaskId(taskId,"xz");
        for(CjXzyxTaskDO xzwjxxado:xzwjxxado_list){
        	CjXzyxProcessDO xzwjxxpdo = new CjXzyxProcessDO();
        	BeanUtils.copyProperties(xzwjxxado,xzwjxxpdo, "id");
        	cjXzyxProcessDao.save(xzwjxxpdo);
        }
        //音响文件信息
        List<CjXzyxProcessDO> yxwjxxpdo_list = cjXzyxProcessDao.findByProcessInstanceId(mainProcessInstanceId,"yx");
        for(CjXzyxProcessDO yxwjxxpdo:yxwjxxpdo_list){  
        	cjXzyxProcessDao.delete(yxwjxxpdo);
        }
        List<CjXzyxTaskDO> yxwjxxado_list = cjXzyxTaskDao.findByTaskId(taskId,"yx");
        for(CjXzyxTaskDO yxwjxxado:yxwjxxado_list){
        	CjXzyxProcessDO yxwjxxpdo = new CjXzyxProcessDO();
        	BeanUtils.copyProperties(yxwjxxado,yxwjxxpdo, "id");
        	cjXzyxProcessDao.save(yxwjxxpdo);
        }
        
        
        

        List<CjWhsxProcessDO> whsxpdo_list = cjWhsxProcessDao.findByProcessInstanceId(mainProcessInstanceId);
        for(CjWhsxProcessDO whsxpdo:whsxpdo_list){  
        	cjWhsxProcessDao.delete(whsxpdo);
        }
        List<CjWhsxTaskDO> whsxado_list = cjWhsxTaskDao.findByTaskId(taskId);
        for(CjWhsxTaskDO whsxado:whsxado_list){
        	CjWhsxProcessDO whsxpdo = new CjWhsxProcessDO();
        	BeanUtils.copyProperties(whsxado,whsxpdo, "id");
        	cjWhsxProcessDao.save(whsxpdo);
        }
        
    }


    protected void guidang(String processId) {
        //馆藏信息
        CjGcxxProcessDO pdo_gcxx = cjGcxxProcessDao.findByProcessInstanceId(processId);
        DjGcxxDO dj_gcxx = new DjGcxxDO();
        BeanUtils.copyProperties(pdo_gcxx, dj_gcxx, "id");
        djGcxxDao.save(dj_gcxx);
        GcxxDO gcxx = new GcxxDO();
        BeanUtils.copyProperties(pdo_gcxx, gcxx, "id");
//        gcxx.setClass_huosa(null);
//        gcxx.setClass_minjian(null);
        gcxx.setIsNew("1");
        String newgcxxid = (String) gcxxDao.save(gcxx);
        //形制信息
        CjXzxxProcessDO pdo_xzxx = cjXzxxProcessDao.findByProcessInstanceId(processId);
        DjXzxxDO dj_xzxx = new DjXzxxDO();
        BeanUtils.copyProperties(pdo_xzxx, dj_xzxx, "id");
        djXzxxDao.save(dj_xzxx);
        XzxxDO xzxx = new XzxxDO();
        BeanUtils.copyProperties(pdo_xzxx, xzxx, "id");
        xzxx.setGcxxId(newgcxxid);
        xzxxDao.save(xzxx);
        //音响信息
        CjYxxxProcessDO pdo_yxxx = cjYxxxProcessDao.findByProcessInstanceId(processId);
        DjYxxxDO dj_yxxx = new DjYxxxDO();
        BeanUtils.copyProperties(pdo_yxxx, dj_yxxx, "id");
        djYxxxDao.save(dj_yxxx);
        YxxxDO yxxx = new YxxxDO();
        BeanUtils.copyProperties(pdo_yxxx, yxxx, "id");
        yxxx.setGcxxId(newgcxxid);
        yxxxDao.save(yxxx);
        
        CjWhrlxxxProcessDO pdo_whrlxxx = cjWhrlxxxProcessDao.findByProcessInstanceId(processId);
        DjWhrlxxxDO dj_whrlxxx = new DjWhrlxxxDO();
        BeanUtils.copyProperties(pdo_whrlxxx, dj_whrlxxx, "id");
        djWhrlxxxDao.save(dj_whrlxxx);
        WhrlxxxDO whrlxxx = new WhrlxxxDO();
        BeanUtils.copyProperties(pdo_whrlxxx, whrlxxx, "id");
        whrlxxx.setGcxxId(newgcxxid);
        whrlxxxDao.save(whrlxxx);

        

        List<CjDbrwProcessDO> dbrwpdo_list = cjDbrwProcessDao.findByProcessInstanceId(processId);
        for(CjDbrwProcessDO dbrwpdo:dbrwpdo_list){  
        	DjDbrwDO dj_dbrw = new DjDbrwDO();
        	BeanUtils.copyProperties(dbrwpdo,dj_dbrw, "id");
        	djDbrwDao.save(dj_dbrw);
        	DbrwDO dbrw = new DbrwDO();
        	BeanUtils.copyProperties(dbrwpdo,dbrw, "id");
        	dbrw.setGcxxId(newgcxxid);
        	dbrwDao.save(dbrw);
        	
        }
        
        //多媒体信息
        List<CjMultimediaProcessDO> multimediapdo_list = cjMultimediaProcessDao.findByProcessInstanceId(processId);
        for(CjMultimediaProcessDO multimediapdo:multimediapdo_list){  
        	DjMultimediaDO dj_multimedia = new DjMultimediaDO();
        	BeanUtils.copyProperties(multimediapdo,dj_multimedia, "id");
        	djMultimediaDao.save(dj_multimedia);
        	MultimediaDO multimedia = new MultimediaDO();
        	BeanUtils.copyProperties(multimediapdo,multimedia, "id");
        	multimedia.setGcxxId(newgcxxid);
        	multimediaDao.save(multimedia);
        	
        }
        //曲目信息
        List<CjTrackmessageProcessDO> trackmessagepdo_list = cjTrackmessageProcessDao.findByProcessInstanceId(processId);
        for(CjTrackmessageProcessDO trackmessagepdo:trackmessagepdo_list){  
        	DjTrackmessageDO dj_trackmessage = new DjTrackmessageDO();
        	BeanUtils.copyProperties(trackmessagepdo,dj_trackmessage, "id");
        	djTrackmessageDao.save(dj_trackmessage);
        	TrackmessageDO trackmessage = new TrackmessageDO();
        	BeanUtils.copyProperties(trackmessagepdo,trackmessage, "id");
        	trackmessage.setGcxxId(newgcxxid);
        	trackmessageDao.save(trackmessage);
        	
        }
        //形制信息
        List<CjXzyxProcessDO> xzwjxxpdo_list = cjXzyxProcessDao.findByProcessInstanceId(processId,"xz");
        for(CjXzyxProcessDO xzwjxxpdo:xzwjxxpdo_list){  
        	DjXzyxDO dj_xzwjxx = new DjXzyxDO();
        	BeanUtils.copyProperties(xzwjxxpdo,dj_xzwjxx, "id");
        	djXzyxDao.save(dj_xzwjxx);
        	XzyxDO xzwjxx = new XzyxDO();
        	BeanUtils.copyProperties(xzwjxxpdo,xzwjxx, "id");
        	xzwjxx.setGcxxId(newgcxxid);
        	xzyxDao.save(xzwjxx);
        	
        }
        //音响信息
        List<CjXzyxProcessDO> yxwjxxpdo_list = cjXzyxProcessDao.findByProcessInstanceId(processId,"yx");
        for(CjXzyxProcessDO yxwjxxpdo:yxwjxxpdo_list){  
        	DjXzyxDO dj_yxwjxx = new DjXzyxDO();
        	BeanUtils.copyProperties(yxwjxxpdo,dj_yxwjxx, "id");
        	djXzyxDao.save(dj_yxwjxx);
        	XzyxDO yxwjxx = new XzyxDO();
        	BeanUtils.copyProperties(yxwjxxpdo,yxwjxx, "id");
        	yxwjxx.setGcxxId(newgcxxid);
        	xzyxDao.save(yxwjxx);
        	
        }
        
        
        List<CjWhsxProcessDO> whsxpdo_list = cjWhsxProcessDao.findByProcessInstanceId(processId);
        for(CjWhsxProcessDO whsxpdo:whsxpdo_list){  
        	DjWhsxDO dj_whsx = new DjWhsxDO();
        	BeanUtils.copyProperties(whsxpdo,dj_whsx, "id");
        	djWhsxDao.save(dj_whsx);
        	WhsxDO whsx = new WhsxDO();
        	BeanUtils.copyProperties(whsxpdo,whsx, "id");
        	whsx.setGcxxId(newgcxxid);
        	whsxDao.save(whsx);
        	
        }
        
    }
}
